package com.rgzn;

public class Player {
    String name;
    static int  score;
    int speed;
    //构造方法，创建对象时调用，创建对象时传入参数，创建对象时初始化对象属性
    public Player(String name) {
        this.name = name;
        this.score = 0;
        this.speed = 10;
    }
    public Player(String name, int score, int speed) {
        this.name = name;
        this.score = score;
        this.speed = speed;
    }
    //方法，（对象可以做的行为）
    public void playGame()  {
        System.out.println(name + "开始游戏");
    }
    //得分
    public void updateScore(int score) {
        this.score += score;
    }
    public static void showScore() {
        System.out.println( "的得分是：" + score);
    }

}